import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Scanner;

public class Del_student {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入需要删除的学号：");
        int id = sc.nextInt();
        String sql = "delete from s_student where stuno=?";
        Connection con =null;
        PreparedStatement ps = null;
        try {
            con=DBUtil.getConnection();
            ps= con.prepareStatement(sql);
            ps.setInt(1,id);
            int i = ps.executeUpdate();
            System.out.println(i);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            DBUtil.close(null,ps,con);
        }
    }
}
